package com.hunan.api.catv.entity.enums;

/**
 * 更新缓存
 */
public enum RefreshCacheEnum {
    shortVideo(1000, "newsListCache", "n::newsList,n::idsList"),

    album(2000, "albumPageCache", "a::albumList,a::idsList"),

    albumVideo(3000, "albumVideoListCache", "v::list"),

    column(4000, "columnCache", "c::list"),

    live(5000, "livePageCache", "l::apiPage"),

    liveTop(5001, "liveTopPageCache", "l::topPage"),

    recommend(6000, "recommendListCache", "r::page"),

    recommendTop(7000, "recommendTopListCache", "r::topList"),

    activity(8000, "activityPageCache", "ac::page,ac::idsList"),

    upgrade(9000, "upgradeCache", "u::lastVersion"),

    homeRecommend(10000, "homeRecommend", "hr::info");

    private final Integer code;

    private final String local;

    private final String redis;

    RefreshCacheEnum(Integer code, String local, String redis) {
        this.code = code;
        this.local = local;
        this.redis = redis;
    }

    public Integer getCode() {
        return code;
    }

    public String getLocal() {
        return local;
    }

    public String getRedis() {
        return redis;
    }

    public static RefreshCacheEnum getResult(int code) {
        RefreshCacheEnum[] rcs = RefreshCacheEnum.values();
        for (RefreshCacheEnum rc : rcs) {
            if (rc.getCode().equals(code)) {
                return rc;
            }
        }
        return null;
    }
}
